package net.xo68.destiny.contract.enums.job;

/**
 * 任务种类枚举
 * @author wuxie
 * @version 2020-9-22
 */
public enum JobTypeEnum {
    /**
     * 简单任务
     */
    SIMPLE_JOB(0,"简单任务"),
    /**
     * 流程任务
     */
    FLOW_JOB(1,"流程任务"),
    /**
     * 流程任务的子任务
     */
    FLOW_CHILD_JOB(2,"流程任务的子任务");

    private final int code;
    private final String title;


    JobTypeEnum(int code, String title) {
        this.code = code;
        this.title = title;
    }

    public int getCode() {
        return code;
    }

    public String getTitle() {
        return title;
    }

    public static JobTypeEnum of(int code){
        for (JobTypeEnum recordType: JobTypeEnum.values()){
            if(code == recordType.getCode()){
                return recordType;
            }
        }
        return JobTypeEnum.SIMPLE_JOB;
    }
}
